package svc

import (
	"gitee.com/lyuanbo/stock-plus/internal/http/biz/router"
	"github.com/cloudwego/hertz/pkg/app/server"
)

type HTTPSvc struct {
	Hz     *server.Hertz
	svcCtx *ServiceContext
}

func NewHTTPService(svcCtx *ServiceContext) *HTTPSvc {
	return &HTTPSvc{
		svcCtx: svcCtx,
	}
}

func (h *HTTPSvc) Start() {
	go h.Run()
}

func (h *HTTPSvc) Run() {
	h.Hz = server.Default()

	router.GeneratedRegister(h.Hz)

	h.Hz.Spin()
}
